package com.c201801020208.ybl.Login.Activity;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

import com.c201801020208.ybl.R;
import com.c201801020208.ybl.User.Activity.MainActivity;

public class PreActivity extends AppCompatActivity {

    private static final int LOGIN_ACITIVIY = 0X1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pre);
        handler.sendEmptyMessageDelayed(LOGIN_ACITIVIY, 2000);
    }

    private Handler handler = new Handler() {
        @Override
        public void handleMessage(@NonNull Message msg) {
            super.handleMessage(msg);
            if (false) {  //如果登录过 跳转到 MainActivity
                Intent intent = new Intent(PreActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
            } else { //如果没有登录过 跳转到 LoginActivity
                Intent intent = new Intent(PreActivity.this, SelectActivity.class);
                startActivity(intent);
                finish();
            }

        }
    };
}
